<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use backend\models\App;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\AppSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '应用';
$this->params['breadcrumbs'][] = $this->title;


?>
<div class="app-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a('新建', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            'name',
            'url:url',
            [
                'attribute' => 'sell_type',
                'content' => function($data, $row) {
                    $typeMap=[App::TYPE_LMD => '乐麦地分站', App::TYPE_SUPPLIER => '供应商网站'];
                    return $typeMap[$data->type];
                },
            ],
            //'key',
            // 'supplier_id',
            // 'type',
            // 'category_filter:ntext',
            // 'gateway',
            // 'enable',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

</div>
